#ifndef WIDGET_H
#define WIDGET_H

#include "ui_widget.h"
#include "common/baseresteditor.h"
#include "m_fhs.h"
#include "m_columns.h"

class Widget : public BaseRestEditor, private Ui::Widget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();

    void generateMenu();
    void customKeyEvent(QKeyEvent *event)
    {
        Q_UNUSED(event)
    }

    void wakeUp();
    void updateTableView();
    void onReceivedObject(const QJsonObject &object);

    void processSchedule(const QJsonObject &object);
    void processPurchaseLog(const QJsonObject &object);
    void processAssembleLog(const QJsonObject &object);
    void processAssembleFlow(const QJsonObject &object);
    void processPosition(const QJsonObject &object);
    void processParlor(const QJsonObject &object);
    void parseArray(const QJsonArray &array);

private slots:
    void on_btn_schedule_clicked();
    void on_btn_purchase_clicked();
    void on_btn_assemblelog_clicked();
    void on_btn_assembleflow_clicked();
    void on_btn_position_clicked();
    void on_btn_parlor_clicked();
    void on_listView_doubleClicked(const QModelIndex &index);
    void on_tableView_doubleClicked(const QModelIndex &index);
    void on_kw_returnPressed();

private:
    int selectId;
    QString _title;
    bool advanced;
};

#endif // WIDGET_H
